﻿#version 330 core

layout (location = 0) in vec3 a_position;
layout (location = 1) in vec2 a_texCoord;
layout (location = 2) in vec4 a_color;
layout (location = 3) in float a_texID;

out vec2 v_texCoord;
out vec4 v_color;
flat out int v_texID;

uniform mat4 u_vp;

void main()
{
	gl_Position = vec4(a_position, 1.0) * u_vp;
	v_texCoord = a_texCoord;
	v_color = a_color;
	v_texID = int(a_texID);
}

#version 330 core

in vec2 v_texCoord;
in vec4 v_color;
flat in int v_texID;

out vec4 color;

uniform sampler2D u_textures[32];

void main()
{
	color = texture(u_textures[v_texID], v_texCoord) * v_color;
}